To be able to edit code and run cells, you need to run the notebook yourself. Where would you like to run the notebook?

This notebook takes about 4 minutes to run.

In the cloud (experimental)

Binder is a free, open source service that runs scientific notebooks in the cloud! It will take a while, usually 2-7 minutes to get a session.

On your computer

(Recommended if you want to store your changes.)

  1. Copy the notebook URL:
  2. Run Pluto

    (Also see: How to install Julia and Pluto)

  3. Paste URL in the Open box

Frontmatter

If you are publishing this notebook on the web, you can set the parameters below to provide HTML metadata. This is useful for search engines and social media.

Author 1
👀 Reading hidden code
using PenPlots, PlutoUI
1.6 s
👀 Reading hidden code
coords = [
Point(i, sin(i/5) + rand())
for i in 1:100
]
223 ms
👀 Reading hidden code
Path(coords)
13.3 μs
👀 Reading hidden code
76.5 μs
point_at_angle (generic function with 1 method)
👀 Reading hidden code
point_at_angle(a) = Point(cos(2π * a), sin(2π * a))
486 μs
80
👀 Reading hidden code
nturns = 80
11.2 μs
👀 Reading hidden code
@bind offset Slider(0:.01:5)
383 ms
👀 Reading hidden code
@bind scale Slider(0.9:.01:1.2)
661 μs
👀 Reading hidden code
10.6 μs
👀 Reading hidden code
[
Path(spiral(false)),
Path(spiral(true)),


# Path((scale * spiral()) .+ Point(offset, 0)),
]
349 ms
spiral (generic function with 1 method)
spiral(special::Bool) = [
if special
p = a * point_at_angle(a)
val = get_value_at(p / 80)

(a + (1-val) / 2) * point_at_angle(a)
else
a * point_at_angle(a)
end

for a in range(0, nturns, 100 * nturns)
]
👀 Reading hidden code
1.2 ms
👀 Reading hidden code
67.7 μs
👀 Reading hidden code
68.0 μs
using Images
👀 Reading hidden code
5.3 s
img = load(download("https://fonsp.com/img/doggoSmall.jpg?raw=true"))
👀 Reading hidden code
968 ms
get_value_at (generic function with 1 method)
function get_value_at(p::Point)

max_size = maximum(size(img)) / 2

q = max_size * p + Point(max_size, max_size)


r(x) = round(Int, x)

color = get(
img,
(
r(q[2]),
r(q[1]),
),
zero(eltype(img)),
)
gray(Gray(color))
end
👀 Reading hidden code
1.2 ms
0.588N0f8
get_value_at(Point(1,0))
👀 Reading hidden code
7.7 ms